package com.woniuxy.homepage.core.controller;


import com.woniuxy.common.CommonResult;
import com.woniuxy.homepage.core.service.CarStyleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author gmx
 * @since 2021-06-29
 */
@RestController
@RequestMapping("/carStyle")
@Api(tags = "车型接口")
public class CarStyleController {

    @Resource
    private CarStyleService carStyleService;


    /**
     * Description : 查询排量  <br/>
     * ChangeLog : 1. 创建 (2021/7/1 11:25 [Hello Mr. Guo]);
     * @param brandId
     * @param typeId
     * @return com.woniuxy.common.CommonResult
    */
    @ApiOperation("查询排量")
    @GetMapping("selectDis")
    public CommonResult selectDis(Integer brandId , Integer typeId){
        List<String> list =  this.carStyleService.selectDis(brandId,typeId);
        if (list == null){
            return CommonResult.fail("查询排量失败");
        }
        return CommonResult.success(list);
    }



    /**
     * Description : 查询年份  <br/>
     * ChangeLog : 1. 创建 (2021/7/1 11:33 [Hello Mr. Guo]);
     * @param brandId
     * @param typeId
     * @param displacement
     * @return com.woniuxy.common.CommonResult
    */
    @ApiOperation("查询年份")
    @GetMapping("selectYear")
    public CommonResult selectYear(Integer brandId , Integer typeId , String displacement){
        List<String> list = this.carStyleService.selectYear(brandId,typeId,displacement);
        if (list == null){
            return CommonResult.fail("查询年份失败");
        }
        return CommonResult.success(list);
    }


    /**
     * Description : 查询款式  <br/>
     * ChangeLog : 1. 创建 (2021/7/1 11:40 [Hello Mr. Guo]);
     * @param brandId
     * @param typeId
     * @param displacement
     * @param year
     * @return com.woniuxy.common.CommonResult
    */
    @ApiOperation("查询款式")
    @GetMapping("selectStyle")
    public CommonResult selectStyle(Integer brandId , Integer typeId , String displacement ,String year){
        List<String> list = this.carStyleService.selectStyle(brandId,typeId,displacement,year);
        if (list == null){
            return CommonResult.fail("查询款式失败");
        }
        return CommonResult.success(list);
    }

}

